#include <bits/stdc++.h>

using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;

const int N=1e6+5;

void Solve(){
    
    return;
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr); std::cout.tie(nullptr);
    int i,j,s,e,a,b,c,sum,ans;
    int s[13]={0,31,29,31,30,31,30,31,31,30,31,30,31}
    scanf("%d%d",&s,&e);
    for(int i=1;i<=12;i++){
        for(int j=1;j<=s[i];j++){
            c=(j%10)*1000+(j/10)*100+(i%10)*10+i/10;
            sum=c*10000+i*100+j;
            if(sum<s||sum>e)continue;
            ans++;
        }
    }
    printf("%d",ans);

    return 0;
}